package com.nega.commons.model;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author: Garcia
 * @CreateDate: 2019/5/9 18:25
 * @Description: what it is class?
 */
@Data
public class Result implements Comparable<Result>{
    /**
     * 标题
     */
    private String title;

    /**
     * URL地址
     */
    private String url;

    /**
     * 内容
     */
    private String content;

    /**
     *来源网站
     */
    private String source;

    /**
     * 内容时间
     */
    private String time;

    /**
     * 舆情 ：1-正面内容，0-负面内容
     */
    private String lyrical;

    /**
     * 负面指数
     */
    private String negativeIndex;


    @Override
    public int compareTo(Result result) {
        if (result == null){
            return -1;
        }
        return Integer.compare((StringUtils.isNotBlank(this.negativeIndex)?
          this.negativeIndex:"").compareTo(StringUtils.isNotBlank(result.getNegativeIndex())?
          result.getNegativeIndex():""), 0);
    }
}
